<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="/pages/common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta charset="utf-8" />
		<title>Simple Examples</title>
		 <link rel="stylesheet" href=<s:url value="/css/common.css"/>>
		<link rel="stylesheet" href="<s:url value="/js/kindeditor-4.1.10/themes/default/default.css"/>" />
		<link rel="stylesheet" href="<s:url value="/css/pm/index.css"/>" />
		<script  type="text/javascript"src="<c:url value="/js/kindeditor-4.1.10/lang/zh_CN.js"/>"></script>
		<script type="text/javascript" src="<c:url value="/js/kindeditor-4.1.10/kindeditor-min.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/jquery-1.9.1.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/jquery.validate.min.js" />"></script>
		<script type="text/javascript" src="<s:url value="/js/pwms.validate.js?v13" />"></script>
		<script type="text/javascript" src="<s:url value="/js/ajaxImg.js"/>"></script>
		<script type="text/javascript">
		var i=0;
		$(document).ready(function(){
			 $("#queryForm").validate({
				debug : true,
				submitHandler : function(form) {
					 i++;
					if(i==1){
						$("#submitBtn").attr("disabled",true);
						form.submit();
					}
				},
				rules : {
					"announce.title" : {  
						required : true,
						maxlength : 16
					 },
					 "announce.content" : {  required : true} 
				},
				messages : {
					"announce.title" : {required:"<b>请输入资讯标题</b>",maxlength:"<b>资讯标题太长</b>"},
					"announce.content" : {  required : "<b>请输入资讯内容</b>"} 
				},
				errorPlacement: function (error, element) {
					 error.insertAfter(element); 
				}
			});
			
		});
			var editor;
			KindEditor.ready(function(K) {
				editor = K.create('#content', {
					resizeType : 1,
					allowImageUpload : true,
					uploadJson : '<s:url value="/upload/informationImg.ct"/>',
		           // fileManagerJson : '../jsp/file_manager_json.jsp',
		            allowFileManager : false,
		        	allowPreviewEmoticons : false,
		        	allowImageRemote:false,
					items : [
						'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link']
				});
			});
			
			function go(){
				window.location.href="<%=basePath%>/announce/queryAnnouncement.ct";
			}
		</script>
	</head>
	<body>
		<div class="subpage">
			<s:form id="queryForm" action="/announce/saveAdd.ct" method="post" theme="simple" enctype="multipart/form-data">
				 
				<!-- 填选区域 -->
				<div>  
					<table class="tb" style="width:100%">
						<thead>
							<tr class="tb-line">
								<td class="tb-td"   colspan="4">
									<div class="tb-h3">
										资讯信息添加
									</div>
								</td>
							</tr>
						</thead>
						<tbody>
							<tr class="tb-line">
								<td class="tb-td" colspan="2">
									资讯信息
								</td>
							</tr>
							<tr class="tb-line">
								<td class="tb-td" align="right" >
									标题：
								</td>
								<td class="tb-td">
									<label class="tb-input-lengthen">
										<s:textfield id="title" name="announce.title" theme="simple" maxLength="16" />
									</label>
									<code class="asterisk">*</code>
								</td>
								 
							</tr>
							<tr class="tb-line">
								<td class="tb-td" colspan="2">
									资讯内容
								</td>
							</tr>
							<tr class="tb-line">
								<td class="tb-td" colspan="2">
								<s:textarea id="content" name="announce.content" style="width:100%;height:200px;visibility:hidden;" ></s:textarea>
								</td>
							</tr>
						</tbody>
					</table>
					<div align="center"  class="line-submit bg-gray">
				    	<label class="tb-input-submit"  >
				            <input id="submitBtn" type="submit" value="提交"/>
				        </label>
				        <label  class="tb-input-submit">
				        	<input type="button" value="返回" onclick="go()" />
				        </label>
				    </div>
				</div>
		         <s:if test="#request.msg !=null">
					<script language="javascript">
						alert("${request.msg}");
					</script>
				</s:if>
				<!-- 填选区域end -->
			</s:form>
		</div>
	</body>
</html>
